﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace iLangl.Tests.AlertsFixture
{
	[TestClass]
	public class ExceptionFixture : BaseTest
	{
		[TestMethod]
		[ExpectedException(typeof(AlertException))]
		public void ExceptionThrow()
		{
			
			Facade.Instance.AlertManager.RaiseAlert(
			new Exception("hello world"));
		}

		[TestMethod]
		
		public void ExceptioNotThrow()
		{

			IAlert alert = Facade.Instance.AlertManager.CreateAlert(this);
			
			alert.AddError(new Error("","",eSeverity.Unknown));
			Facade.Instance.AlertManager.RaiseAlert(alert);

			alert.AddError(new Error("","",eSeverity.Low));
			Facade.Instance.AlertManager.RaiseAlert(alert);

			alert.AddError(new Error("","",eSeverity.Low));
			Facade.Instance.AlertManager.RaiseAlert(alert);

		}

		[TestMethod]
		[ExpectedException(typeof(AlertException))]
		public void ExceptionThrowForHigh()
		{

			IAlert alert = Facade.Instance.AlertManager.CreateAlert(this);

			alert.AddError(new Error("", "", eSeverity.High));
			Facade.Instance.AlertManager.RaiseAlert(alert);
		}


		[TestMethod]
		[ExpectedException(typeof(AlertException))]
		public void ExceptionThrowForCritical()
		{

			IAlert alert = Facade.Instance.AlertManager.CreateAlert(this);

			alert.AddError(new Error("", "", eSeverity.Critical));
			Facade.Instance.AlertManager.RaiseAlert(alert);
		}

	}
}
